﻿using System.ComponentModel;
using System.Configuration.Install;
using System.ServiceProcess;
using System.Diagnostics;


namespace Etudica.McHAM.SDM_Server
{
    [RunInstaller(true)]
    public partial class ProjectInstaller : Installer
    {
        public ProjectInstaller()
        {
            InitializeComponent();
        }

        private void ProjectInstaller_AfterInstall(object sender, InstallEventArgs e)
        {
            try
            {
                ServiceController s = new ServiceController(this.serviceInstaller1.ServiceName);
                s.Start();
            }
            catch { }
        }

        private void ProjectInstaller_BeforeUninstall(object sender, InstallEventArgs e)
        {
            try
            {
                ServiceController s = new ServiceController(this.serviceInstaller1.ServiceName);
                if (s.Status != ServiceControllerStatus.Stopped)
                {
                    s.Stop();
                    s.WaitForStatus(ServiceControllerStatus.Stopped);
                }
            }
            catch { }

        }

      
    }
}
